<?php $this->load('header')?>

<?php $this->showTabs() ?>

<form name="post" id="post" method="post" action="<?php URL('post.write')?>" onsubmit="return check_write()">
<input type="hidden" name="dosubmit" value="yes" />
<input type="hidden" name="type" value="blog" />
<input type="hidden" name="id" value="<?php echo $post['id']?>" />
	
<div class="main">
	<div class="main_left">
	<div class="inner_left">
	<table width="100%">
		<tr>
			<td align="right" style="min-width: 40px;">标题：</td>
			<td>
			<input type="text" name="title" class="input" size="70" value="<?php echo $post['title']?>" onfocus="if(this.value=='未命名文章')this.value=''" />
			<select name="cateid">
				<?php $this->showCateOptions('blog',$post['cateid']);?>
			</select>
			</td>
		</tr>
		<tr>
			<td valign="top" align="right">内容：</td>
			<td>
			<?php Editor::full('content', $post['content']);?>
			</td>
		</tr>
		
		<tr>
		<td></td><td>
			<input type="submit" class="button" value="发布文章" />
			<input type="button" class="button" value="另存为草稿" onclick="save_to_draft()" />
			<input type="button" class="button" value="返回上一页" onclick="history.back()" />
		</td>
		</tr>
	</table>

	</div>
	</div>

	<!--sidebar-->
	<div class="main_right">
		<div class="panel">
			<div class="title">高级选项</div>
			<div class="body">
			<p>时间：
			<input type="text" name="year"  style="width:40px" maxlength="4" value="<?php echo $datetime['year']?>">年
			<input type="text" name="month" style="width:23px" maxlength="2" value="<?php echo $datetime['mon']?>">月
			<input type="text" name="day" style="width:23px" maxlength="2" value="<?php echo $datetime['mday']?>">日
			<input type="text" name="hour" style="width:23px" maxlength="2" value="<?php echo $datetime['hours']?>">时
			<input type="text" name="minute" style="width:23px" maxlength="2" value="<?php echo $datetime['minutes']?>">分
			</p>
			<p><input type="checkbox" class="checkbox" name="commentstatus" id="commentstatus" value="1" <?php if ($post['commentstatus']==1) {echo 'checked';} ?> /><label for="commentstatus">这篇文章允许评论</label></p>
			</div>
		</div>

		<div class="panel">
			<div class="title">文章标签</div>
			<div class="body">
			<p>
			<input type="text" class="input" name="tags" id="tags" style="width:90%" value="<?php echo $post['tags']?>" /><br />
			<em>多个标签使用英文逗号","分隔</em>
			</p>
			<fieldset id="hot_tags">
				<legend>热门标签</legend>
				<div class="tags">
				<?php echo $hottags; ?>
				</div>
			</fieldset>
			</div>
		</div>

		<div class="panel">
			<div class="title">文章别名</div>
			<div class="body">
			<p><input type="text" name="alias" style="width:90%" value="<?php echo $post['alias']?>" onkeyup="this.value=this.value.replace(/[^a-z0-9\-_.]/ig,'')" onblur="check_urlname()" /></p>
			<em>由字母、数字、下划线、减号、小数点组成</em>
			</div>
		</div>

		<div class="panel">
			<div class="title">文章访问密码</div>
			<div class="body">
			<p><input type="text" name="password" style="width:90%" maxlength="15" value="<?php echo $post['password']?>" /></p>
			<em>15个字符以内</em>
			</div>
		</div>

	</div>

</div>

</form>

<script type="text/javascript">
$(function() {
	$('#hot_tags a').each(function(){
		$(this).click(function() {
			if ($(this).attr('class') == 'on') {
				$('#tags').val($('#tags').val().replace($(this).text() + ',',''));
				$(this).removeClass('on')
			} else {
				$('#tags').val($('#tags').val() + $(this).text() + ',');
				$(this).addClass('on');
			}
		});
	});
});
set_tags_on();
</script>

<?php $this->load('footer')?>